-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow passing versioned media types to 7.x server #63071
Conversation
7.x client can pass media type with a version which will return a 7.x version of the api in ES 8. In ES server 7 this media type shoulld be accepted but it serve the same version of the API (7x)
Pinging @elastic/es-core-infra (:Core/Infra/REST API) |
@elasticmachine run elasticsearch-ci/2 |
* | ||
* @return a media type string without | ||
*/ | ||
private static String removeVersionInMediaType(String mediaType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to wrap this in if(mediaType.contains("vnd.elasticsearch"){ ...} else return mediaType. It is a micro-optimization, but will probably save a few CPU cycles. Also I think you can collapse the two replaceAll into a single line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, 1 minor optional comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
a follow up after elastic#63071 where it missed the XContentType.fromMediaType method. That method also have to remove the vendor specific substrings (vnd.elasticsearch+ and compatible-with parameter) from mediaType value relates elastic#51816
7.x client can pass media type with a version which will return a 7.x
version of the api in ES 8.
In ES server 7 this media type shoulld be accepted but it serve the same
version of the API (7x)
relates #51816